<?php
class ControllerAccountLogout extends FrontController {
	public function index() {
    	if ($this->customer->isLogged()) {
      		$this->customer->logout();
	  		$this->cart->clear();

			unset($this->session->data['wishlist']);
			unset($this->session->data['shipping_address_id']);
			unset($this->session->data['shipping_country_id']);
			unset($this->session->data['shipping_zone_id']);
			unset($this->session->data['shipping_postcode']);
			unset($this->session->data['shipping_method']);
			unset($this->session->data['shipping_methods']);
			unset($this->session->data['payment_address_id']);
			unset($this->session->data['payment_country_id']);
			unset($this->session->data['payment_zone_id']);
			unset($this->session->data['payment_method']);
			unset($this->session->data['payment_methods']);
			unset($this->session->data['comment']);
			unset($this->session->data['order_id']);
			unset($this->session->data['coupon']);
			unset($this->session->data['reward']);
			unset($this->session->data['voucher']);
			unset($this->session->data['vouchers']);

      		$this->redirect(US('account/logout'));
    	}

		$this->document->setTitle($this->_['heading_title']);

		$this->data['breadcrumbs'][] = array(
        	'text'      => $this->_['text_account'],
			'href'      => US('account/account'),
        	'separator' => $this->_['text_separator']
      	);

      	$this->data['breadcrumbs'][] = array(
        	'text'      => $this->_['text_logout'],
			'href'      => US('account/logout'),
        	'separator' => $this->_['text_separator']
      	);

    	$this->data['heading_title'] = $this->_['heading_title'];
    	$this->data['text_message'] = $this->_['text_message'];
    	$this->data['button_continue'] = $this->_['button_continue'];
    	$this->data['continue'] = HTTP_SERVER;

		$this->display('common/success.tpl');
  	}
}
?>